﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UploadImage.aspx.cs" Inherits="Admin_ThuVienAnh_UploadImage" %>
<%@ Register Assembly="CuteWebUI.AjaxUploader" Namespace="CuteWebUI" TagPrefix="cc1" %>
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../CSS/Home.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
	    function upload_click() 
	    {
	        var submitbutton = document.getElementById('<%=cmdUpload.ClientID %>');
	        var uploadobj = document.getElementById('<%=UploadImage.ClientID %>');
	        var cboBoSuuTap = document.getElementById('<%=cboBoSuuTap.ClientID%>');
	        var indexSelected = cboBoSuuTap.selectedIndex
	        var urlSelected = cboBoSuuTap.options[indexSelected].value;
	        if (urlSelected == "0") {
	            alert("Chưa chọn Bộ sưu tập để upload");
	            return false;
	        }
	        if (!window.filesuploaded) 
	        {
	            if (uploadobj.getqueuecount() > 0) 
	            {
	                uploadobj.startupload();
	            }
	            else 
	            {
	                var uploadedcount = parseInt(submitbutton.getAttribute("itemcount")) || 0;
	                if (uploadedcount > 0) {
	                    return true;
	                }
	                alert("Chưa chọn Tập tin để upload");
	            }
	            return false;
	        }
	        window.filesuploaded = false;
	        return true;
	    }
	</script>
</head>
<body>
	<form runat="server">
    <asp:ScriptManager ID="Scriptmanager1" runat="server"></asp:ScriptManager>	
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>   
        <table border="0" width="100%" cellpadding="0" cellspacing="0">
            <tr><td colspan="4" height="10"></td></tr>
            <tr>
                <td width="20"></td>
                <td width="80" class="hrm_title_blue">Bộ sưu tập</td>
                <td width="7" class="hrm_title_blue">:</td>        
                <td>
                    <asp:DropDownList ID="cboBoSuuTap" CssClass="hrm_combobox" Width="205px" runat="server"></asp:DropDownList>
                </td>
            </tr> 
            <tr><td colspan="4" height="10"></td></tr>        
            <tr>
                <td width="20"></td>
                <td width="80" class="hrm_title_blue" valign="top" style="padding-top:3px">Tải hình ảnh</td>
                <td width="7" class="hrm_title_blue" valign="top" style="padding-top:3px">:</td>        
                <td valign="top">
          
                        <cc1:UploadAttachments runat="server" 
                            MultipleFilesUpload="true" 
                            ManualStartUpload="true" ID="UploadImage" 
                            InsertText="Chọn ảnh" CancelAllMsg="Hủy tất cả" 
                            UploadingMsg="...Đang tải ảnh..." 
                            onfileuploaded="UploadImage_FileUploaded" 
                            onattachmentremoveclicked="UploadImage_AttachmentRemoveClicked" 
                            RemoveButtonText="Xóa" >
		                    <InsertButtonStyle Font-Size="11px"  />
		                    <CancelButtonStyle Font-Size="11px"  />
		                    <VALIDATEOPTION MaxSizeKB="3072" />
	                        <TableStyle CssClass="AjaxUploaderAttachmentsTable" />
                            <CancelButtonStyle Font-Size="11px" CssClass="hrm_button" />
	                    </cc1:UploadAttachments>
	                 <asp:Button runat="server" ID="cmdUpload" style="font-family:Tahoma; font-size:11px" OnClientClick="return upload_click()" Text="Lưu" OnClick="cmdUpload_Click" />
                </td>
            </tr>           
        </table>  
        </ContentTemplate>
    </asp:UpdatePanel>                
	</form>
</body>
</html>
